import Vue from 'vue'
let vm = new Vue();
import store from '@/store'
// import {
// 	createLivekitMessage
// } from '@/utils/message/livekitMessage'
// import * as API_liveKit from '@/api/livekit'

export function checkLiveKit(message) {
  let globalData = getApp().globalData
  let online = store.getters.onLine
  const callId = store.getters.callId
  switch (message.action) {
    case '600':
      if (!online) {
		if (vm.$nativeRtc.isUIKitEnable() ) {
			store.commit('user/SET_ONLINE', true)
			store.commit('user/SET_CALLID', message.sender)
			console.log('message',message)
			let newMessage = {
				"sender": message.sender,
				"action": message.action,
				"content": message.content,
				"timestamp": message.timestamp
			}
			console.log('newMessage',newMessage)
			vm.$nativeRtc.onReceiveMeetingRing(newMessage)
		  }else{
			uni.navigateTo({
			  url: '/pages/livekit/playing?tag='+message.content
			})
		  }
		 
		} else {
		}
      break;
    case '601':
      uni.$emit('orderMeetToast', message)
      break;
    case '603':
      uni.$emit('ortherAccept', message)
      break;
	case '604':
     uni.$emit('ortherReject', message)
     break;
    }
}